package com.eedi.org.facade;

import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;

/**
 * @Project eedi-org
 * @Description
 * @Author TomBombadil
 * @Date 2024/08/13 09:53
 **/
public interface OrgDeptFacade {

    /**
     * 获取科室名称

     *
     * @param deptId         用户Id
     * @param fillInConsumer 填充科室名称的Consumer，如setDeptName(String deptName);
     */
    void fillInDeptName(@Validated @NotBlank String deptId, @Validated @NotNull Consumer<String> fillInConsumer);

    /**
     * 根据deptId获取deptName
     */
    <T> void fillInDeptName(@Validated @NotNull Collection<T> deptColl, Function<T, String> deptIdGetter, BiConsumer<T, String> deptNameConsumer);

    /**
     * 根据deptName获取deptId
     * @param sourceParams
     * @param deptNameGetter
     * @param deptIdConsumer
     * @param <T>
     */
    <T> void fillInDeptId(@Validated @NotNull Collection<T> sourceParams, Function<T, String> deptNameGetter, BiConsumer<T, String> deptIdConsumer);

}
